package com.litchishell.feartures.main;

import com.litchishell.feartures.dao.Consumer;

import java.util.Arrays;
import java.util.List;

/**
 * @author LitchiShell
 * @description: Consumer--->accept
 * @create 2021-11-20
 */
public class ConsumerTest {

    public static <T> void forEach(List<T> list, Consumer<T> consumer) {
        for (T item : list) {
            consumer.accept(item);
        }
    }

    public static void main(String[] args) {
        forEach(Arrays.asList(1,2,3,4),(Integer i) -> System.out.println(i));
    }
}
